import asyncio
import websockets
import time 


async def ws_client_test(url):

    async with websockets.connect(url) as websocket:
        await websocket.send("hello! hello!")
        response = await websocket.recv()
        print(response)
        pass 
        
        time.sleep(5)
        await websocket.close()

if __name__ == "__main__":

    #连接的地址
    url = "ws://localhost:3000/index"

    #运行程序
    asyncio.run(ws_client_test(url))

    #https://ecn.t0.tiles.virtualearth.net/tiles/a33333333.jpeg?g=7234